package cn.ggcms.cms.action.channels;

import java.util.List;
import org.apache.struts2.ServletActionContext;
import cn.ggcms.cms.biz.ChannelsBiz;
import cn.ggcms.cms.vo.Channels;
import com.opensymphony.xwork2.ActionSupport;

public class ChannelsAction extends ActionSupport {

	private static final long serialVersionUID = 1L;

	private ChannelsBiz channelsBiz;

	private List<Channels> channels;

	private Channels ochannel;
	private  Integer id;

	public ChannelsBiz getChannelsBiz() {
		return channelsBiz;
	}

	public void setChannelsBiz(ChannelsBiz channelsBiz) {
		this.channelsBiz = channelsBiz;
	}

	public List<Channels> getChannels() {
		return channels;
	}

	public void setChannels(List<Channels> channels) {
		this.channels = channels;
	}

	

	public Channels getOchannel() {
		return ochannel;
	}

	public void setOchannel(Channels ochannel) {
		this.ochannel = ochannel;
	}

	public String getAll() {
		channels = channelsBiz.findChannels();
		return "getallsuccess";

	}

	public String addchannel() {
		channelsBiz.doInsertChannels(ochannel);
		return "addsuccess";

	}

	public String deletechannel() {
		id=Integer.valueOf(ServletActionContext.getRequest().getParameter("id"));
		channelsBiz.doDeleteChannelsById(id);
		return "deletesuccess";
	}
	public String uplodechannel() {
		channelsBiz.doUpdateChannels(ochannel);
		return "uplodesuccess";
	}
	public String getchannel() {
		id=Integer.valueOf(ServletActionContext.getRequest().getParameter("id"));
		ochannel=channelsBiz.findChannelsById(id);
		return "getchannelsuccess";
	}
}
